//Set up local variables, because that's cool :)
local hud 		= {}
hud.Count 		= 0 //usermessage counter
hud.CountHUD 	= 0 //usermessages multiplied by 5, to get umsg/s
hud.PrintTime 	= 0 //next umsg calculation
hud.FPS 		= 0 //FPS, obviously :)

function Draw_HUD()
	local client = LocalPlayer()

	if !client:Alive() then return end //if dead stop here
	if (client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == "Camera") then return end //if you're using the camera dont show

	draw.SimpleTextOutlined("UsrMgs/sec: " .. math.floor(hud.CountHUD), "ScoreboardText", ScrW() / 2, ScrH() / 2 + 100, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, Color(0,0,0,255))
	draw.SimpleTextOutlined("FPS: " .. math.floor(hud.FPS), "ScoreboardText", ScrW() / 2, ScrH() / 2 + 80, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, Color(0,0,0,255))
end

function Think()
	if (CurTime() >= hud.PrintTime) then
		hud.FPS = 1/RealFrameTime() //calculate FPS
		hud.CountHUD = hud.Count * 5
		hud.Count = 0
        hud.PrintTime = CurTime() + 0.2 //tick again in 200ms
    end
end

function UserMsg_func( um )
	hud.Count = hud.Count + 1 //add one to count the usmg's
end

hook.Add("HUDPaint", "HUD_Test12345", Draw_HUD)
hook.Add("Think", "HUD_Test123456", Think)
//Hook all wiremod umsg's
usermessage.Hook("hispeed_datastream", UserMsg_func)
usermessage.Hook("wire_cpu_error", UserMsg_func)
usermessage.Hook("hispeed_datamessage", UserMsg_func)
usermessage.Hook("wire_expression2_fileload", UserMsg_func)
usermessage.Hook("wire_holograms_set_scale", UserMsg_func)
usermessage.Hook("wire_holograms_clip", UserMsg_func)
usermessage.Hook("wire_expression2_download", UserMsg_func)
usermessage.Hook("UpdateEyePodState", UserMsg_func)
usermessage.Hook("wiregpu_memorymessage", UserMsg_func)
usermessage.Hook("wiregpu_onuse", UserMsg_func)
usermessage.Hook("HUDIndicatorStylePercent", UserMsg_func)
usermessage.Hook("HUDIndicatorStyleFullCircle", UserMsg_func)
usermessage.Hook("HUDIndicatorRegister", UserMsg_func)
usermessage.Hook("HUDIndicatorUnRegister", UserMsg_func)
usermessage.Hook("HUDIndicatorFactor", UserMsg_func)
usermessage.Hook("HUDIndicatorHideHUD", UserMsg_func)
usermessage.Hook("wire_keyboard_releaseinput", UserMsg_func)
usermessage.Hook("wire_keyboard_blockinput", UserMsg_func)
usermessage.Hook("wire_textscreen_SetText", UserMsg_func)
usermessage.Hook("wire_textscreen_SendConfig", UserMsg_func)
usermessage.Hook("wire_gpulib_setent", UserMsg_func)